package com.ten.security.hander;

import com.ten.common.core.vo.Result;
import com.ten.security.exception.PermissionException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author ：Q大侠
 * @date ：Created in 2022/12/2 20:06
 * @description：全局异常处理类
 * @modified By：
 * @version:
 */
//标记该类为全局异常处理类
@RestControllerAdvice
public class MyGlobleHandler {
    /** 
     * @create by:  Q大侠
     * @description: 如果你抛出PermissionException，则有该方法处理这个异常 
     * @create time: 2022/12/2 20:07
      * @param  
     * @return  
     */
    @ExceptionHandler(value = PermissionException.class)
    public Result<String> permissonException(PermissionException e){
        return new Result<String>(4001,e.getMessage());
    }
}
